<%-- 
    Document   : chinhsuathongtinsanpham
    Created on : Nov 5, 2011, 4:20:34 PM
    Author     : Rocker000
--%>

<%@page import="dao.SanPham_dao"%>
<%@page import="pojo.SanPham_pojo"%>
<%@page import="pojo.LoaiSanPham_pojo"%>
<%@page import="pojo.LoaiSanPham_pojo"%>
<%@page import="dao.LoaiSanPham_dao"%>
<%@page import="pojo.ThuongHieu_pojo"%>
<%@page import="dao.ThuongHieu_dao"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
String masanpham = request.getParameter("masanpham");
SanPham_pojo sp = SanPham_dao.LaySanPhamTheoMa(masanpham);
LoaiSanPham_pojo loai = LoaiSanPham_dao.LayLoaiTheoMa(sp.getMaLoai());
ThuongHieu_pojo hieu = ThuongHieu_dao.LayThuongHieuTheoMaThuongHieu(sp.getHieu());
%>


<form action="sanpham_controller"   method="post"  name="form1" id="form1">
<table width="100%" border="0">
    <tr>
    <td colspan="2" align="center"><strong><font color="#FF0000">CHỈNH SỬA THÔNG TIN SẢN PHẨM</font></strong></td>
    </tr>
    <tr>
    <td>Hình Ảnh Sản Phẩm:</td>
    <tr><td height="327" align="center" valign="top" colspan="2"><img src="<%=sp.getImage()  %>" width="50%" height="100%" /></td></tr>
  </tr>      
  <tr>
    <td>Mã Sản Phẩm:</td>
    <td><input type="text" name="txtmasanpham" id="txtmasanpham"  value="<%=sp.getMaSanPham() %>" /></td>
  </tr>
  <tr>
    <td width="150px">Tên Sản Phẩm:</td>
    <td width=""><input type="text" name="txttensanpham" id="txttensanpham" value="<%=sp.getTenSanPham() %>" /></td>
  </tr>
  <tr>
      <%ArrayList<LoaiSanPham_pojo> dsloaisanpham=LoaiSanPham_dao.LayToanBoDanhSach(); %>
    <td>Loại sản Phẩm:</td>
    <td>
        <select name="cbloaisanpham" id="cbloaisanpham">
            <option value="<%=loai.getMaLoaiSanPham()%>"><%=loai.getTenLoaiSanPham() %></option>
            <%for(int i=0;i<dsloaisanpham.size();i++){ %>
            <option value="<%=dsloaisanpham.get(i).getMaLoaiSanPham() %>"><%=dsloaisanpham.get(i).getTenLoaiSanPham() %></option><%}%>
        
      </select>
  </td>
  </tr>
  <tr>
    <td>Thương Hiệu:</td>
    <td>
        <%ArrayList<ThuongHieu_pojo> ds_thuonghieu = ThuongHieu_dao.LayToanBo(); %>
      <select name="cbthuonghieu" id="cbthuonghieu">
          <option value="<%=hieu.getMaThuongHieu() %>"><%=hieu.getTenThuongHieu() %></option>>
         <%for(int i =0;i<ds_thuonghieu.size();i++){ %> 
         <option value="<%=ds_thuonghieu.get(i).getMaThuongHieu() %>"><%=ds_thuonghieu.get(i).getTenThuongHieu() %></option><%}%>
      </select>
  </td>
  </tr>
  <tr>
    <td>Số Lượng Tồn:</td>
    <td>
        <input type="text" name="txtsoluongton" id="txtsoluongton" value="<%=sp.getSoLuongTon() %>" /></td>
  </tr>
  <tr>
    <td>Kích Thước:</td>
    <td>
        <input type="text" name="txtkichthuoc" id="txtkichthuoc" value="<%=sp.getKichThuoc() %>" /></td>
  </tr>
  <tr>
    <td>Giá :</td>
    <td>
        <input type="text" name="txtgia" id="txtgia" value="<%=sp.getGia()%>"/>(KVND)</td>
  </tr>
  
  <tr>
    <td valign="top">Một số chỉ tiết khác:</td>
    <td><textarea name="txtchitiet" id="txtchitiet" cols="45" rows="5" value="<%=sp.getChiTietSanPham() %>"></textarea></td>
  </tr>
  <tr>
    <td colspan="2">
        <input type="submit" name="btthem" id="btthem" value="Cập Nhật" />
        <input type="hidden" name="action" value="capnhatsanpham">
    </td>
    
    </tr>
</table>
</form>
